package com.lianjia.sh.tools.msg.v2.sender.impl;

import com.lianjia.sh.tools.msg.v2.message.Msg;
import com.lianjia.sh.tools.msg.v2.sender.Sender;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by yangsp1 on 16/6/24.
 */
public class SenderCompositeImpl{
    List<Sender> senders = new ArrayList<>();

    public boolean send(Msg msg) {
        for(Sender sender : senders){
            if(msg.isMatch(sender)) {
                msg.invokSend(sender);
            }
        }
        return true;
    }

    public List<Sender> getSenders() {
        return senders;
    }

    public void setSenders(List<Sender> senders) {
        this.senders = senders;
    }
}
